<template>
  <div class="hello">
    <div class="sm-offset-2 header" >
      <a href="javascript:;">
        <img src="../assets/logo.png" alt="">
      </a>
    </div>
    <div id="main">
      
      <div class="row">
<div class="col-sm-12" style="margin-top: 8%;"></div>
      
      <div class="col-sm-7" style="text-align: center;">
        <img style="margin-bottom: 50px" src="../assets/text.png">
        <img src="../assets/slogan.png">
      </div>
      <div class="login col-sm-3 ">
        <!-- <form id="login-form" action="/login" method="post" role="form"> -->
        <form id="login-form" >
          <input type="hidden" name="_csrf" value="LTJDX2xiWXZbXS9mLQ0JEnt8GmgKAWkxb2skLjQabQRKbSUSC1RoNA==">
          <div class="form-group">
            <div>
              <div class="form-group field-loginform-username required">
                <div style="position:relative;">
                  <i class="fa fa-user fa-2x"></i><input type="text" id="loginform-username" class="form-control" name="LoginForm[userName]" placeholder="请输入用户名/手机号" v-model="userName" @focus="focus = true" @blur="focus = false">
                  <i v-if="username && focus" v-on:mousedown="clearName" id="close1" class="fa fa-times-circle fa-2x"></i>
                  <span class="help-block m-b-none">
                    <p class="help-block help-block-error"></p>
                  </span>
                </div>
              </div>
            </div>
          </div>
          <div class="form-group">
            <div>
              <div class="form-group field-loginform-password required">
                <div style="position:relative;">
                  <i class="fa fa-lock fa-2x"></i><input type="password" id="loginform-password" class="form-control" name="LoginForm[password]" placeholder="请输入密码" v-model="password">
                  <i v-if="password" v-on:click="clearPass" id="close2" class="clo fa fa-times-circle fa-2x"></i>
                  <span class="help-block m-b-none">
                    <p class="help-block help-block-error"></p>
                  </span>
                </div>
              </div>
            </div>
          </div>
          <br>
          <div class="form-group">
            <button type="button" class="btn mui-btn-primary" style="height:45px; font-size:16px;" @click="login1()">登录</button>
          </div>
          <div class="form-group">
            <p class="text-muted text-center" style="text-align: center;">
              <a style="color: white;" href="/site/find-pass">忘记密码</a>
            </p>
          </div>
        </form>
      </div>
      </div>
    </div>
  
  <div style="background-color: white;margin-top: 20px;">
    <div style="text-align: center;">© 秒讯科技 湖北 鄂ICP备17016992号-1
    </div>
  </div>
  </div>
</template>

<script>
import { Toast } from 'mint-ui';
export default {
  name: 'hello',
  data () {
    return {
      msg: 'Welcome to Your Vue.js App',
      userName: '',
      password: ''
    }
  },
  methods: {
    login1() {
      var userName = this.userName;
      var pw = this.pw;
      var url = 'http://192.168.1.216/public/index.php/Home/login/login';
      this.$http.post(url, { username: this.userName, password: this.password }, { emulateJSON: true }).then(function(res) {
        console.log(res.body)
        if (res.body.status == -1) {
          Toast(res.body.msg);
        } else {
          Toast(res.body.msg);
          this.$router.push('/index');
        }
      })
      console.log(111);
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang='less' scoped>
.hello{
  position: relative;
  z-index: 999;
  top:0px;
}
*{
  padding: 0;
  margin: 0;
}
.login {
        border-radius: 20px;
        background: rgba(255,255,255,0.2);
        padding: 50px;
        margin-top: 35px;
        transition: .3s all linear;
      
    }
    .login:hover {
        box-shadow: 0 8px 16px 0 rgba(7,17,27,.2);
    }
    input {
        padding: 17px !important;
        padding-left: 50px !important;
        height: 50px !important;
    }
    i.fa {
        position: absolute;
        left: 15px;
        top: 11px;
        color: #cfcfcf;
    }
    button {
        width: 100%;
    }
    #main {
        background: url("../assets/background.jpg") no-repeat;
        background-size: 100%;
        height: 80vh;
    }
    #close1,#close2 {
        position: absolute;
        color: yellow;
        left: 90%;
        cursor: pointer;
    }
    body {
        background: white !important;
    }
    // 头部样式
.header{
    // margin-top: 20px;
    background:white;
    position: relative;
    height: 80px;
    a{
      width: 145px;
      height: 58px;
      margin-left: 50px;
      img{
        display: inline-block;
        width: 145px;
        height: 58px;
        position: absolute;
        top: 20px;
        left: 80px;
      }
    }
  }
</style>
